home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / Cosmic Defender.swf / scripts / frame_23 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  3.1 KB  |  103 lines

  1. _root.LevelInit();
  2. _root.astronauts = 0;
  3. i = 1;
  4. while(i < _root.max_astronauts)
  5. {
  6.    _root.attachMovie("man","man_" + i,i + 10);
  7.    i++;
  8. }
  9. _root.onEnterFrame = function()
  10. {
  11.    if(!_root.paused)
  12.    {
  13.       if(_root.baiters_time < 0 && _root.player_on)
  14.       {
  15.          _root.AttachOnLevel(0);
  16.          _root.baiters_time = 400;
  17.       }
  18.       else
  19.       {
  20.          _root.baiters_time -= 1;
  21.       }
  22.       if(_root.hyperspace)
  23.       {
  24.          _root.ship_speed = 0;
  25.          _root.hyper_d = _root.ship_x - _root.hyper_x;
  26.          _root.ship_0._x = 275;
  27.          _root.ship_0._xscale = (- _root.hyper_d) * 5;
  28.          _root.ship_0._alpha = 20000 / Math.abs(_root.hyper_d * 5);
  29.          _root.ship_x -= _root.hyper_d / 6;
  30.          if(Math.abs(_root.hyper_d) < 20)
  31.          {
  32.             _root.ship_0._xscale = _root.hyper_d >= 0 ? -100 : 100;
  33.             _root.ship_0._alpha = 100;
  34.             _root.ship_0.to_y = _root.ship_0._y;
  35.             _root.hyperspace = false;
  36.             if(!_root.player_on)
  37.             {
  38.                _root.EnemyAttach(0,false,275,210);
  39.             }
  40.          }
  41.       }
  42.       if(_root.globalBang > 0)
  43.       {
  44.          if(_root.globalBang < 100)
  45.          {
  46.             _root.bigBangColor = new Color(_root);
  47.             _root.colTrans = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
  48.             _root.colTrans.rb = _root.globalBang * 25;
  49.             _root.bigBangColor.setTransform(_root.colTrans);
  50.             _root._x = (Math.random() - 0.5) * _root.globalBang;
  51.             _root._y = (Math.random() - 0.5) * _root.globalBang;
  52.             _root.globalBang -= 1;
  53.             if(_root.globalBang == 0)
  54.             {
  55.                _root._x = 0;
  56.                _root._y = 0;
  57.                _root.colTrans = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
  58.                _root.bigBangColor.setTransform(_root.colTrans);
  59.             }
  60.          }
  61.          else
  62.          {
  63.             _root._x = (Math.random() - 0.5) * (_root.globalBang - 100);
  64.             _root._y = (Math.random() - 0.5) * (_root.globalBang - 100);
  65.             _root.globalBang -= 1;
  66.             if(_root.globalBang == 100)
  67.             {
  68.                _root._x = 0;
  69.                _root._y = 0;
  70.                _root.globalBang = 0;
  71.             }
  72.          }
  73.       }
  74.       if(_root.timer_enemy <= 0)
  75.       {
  76.          if(_root.player_on)
  77.          {
  78.             _root.AttachOnLevel(_root.level);
  79.          }
  80.          _root.timer_enemy = Math.random() * 30 + _root.en_appear_time;
  81.       }
  82.       else
  83.       {
  84.          _root.timer_enemy -= 1;
  85.       }
  86.       j = 0;
  87.       while(j < 16)
  88.       {
  89.          dot = eval("_root.locator.man_" + j);
  90.          dot._x = _root.ToRadarCoords(eval("_root.man_" + j).x);
  91.          dot._y = eval("_root.man_" + j)._y / 10 + 7;
  92.          dot = eval("_root.locator.ship_" + j);
  93.          dot._x = _root.ToRadarCoords(eval("_root.ship_" + j).x);
  94.          dot._y = eval("_root.ship_" + j)._y / 10 + 7;
  95.          j++;
  96.       }
  97.       _root.mountain._x = - _root.ship_x;
  98.       _root.radar_1._x = (- (_root.ship_x - 130)) / 10;
  99.       _root.radar_2._x = (- (_root.ship_x - 4845)) / 10;
  100.    }
  101. };
  102. stop();
  103.